Remove unused code and simplify internal APIs#12
Merged
Conversation
Dead code removal: - types.h: Remove C++20-redundant operator!= on Size_2i and layout_cache_key_t, unused set_preview_source/set_preview_source_ref and ensure_preview_config - constants.h: Remove 4 unused constants (k_grid_line_half_px, k_max_grid_levels, k_drawn_x_reserve, k_index_growth_step) - algo.h: Remove unused current_level parameter from choose_lod_level - function_sample.h: Remove unused timestamp(), generate_with_range(), make_function_sample_policy() - layout_calculator.h: Remove unused horizontal_finest_step field, merge duplicate namespace blocks - asset_loader: Remove unused override_directory() getter - series_renderer: Remove write-only metrics_t struct and all metric writes - vnm_qt_safe_dispatch.h: Remove 6 unused dispatch functions (safe_invoke, blocking_invoke, try_blocking_invoke, safe_emit, post_emit, post_emit_batch) and all convenience overloads, keeping only post_invoke (839 -> 173 lines) - utf8_utils: Remove 8 unused functions (utf8_decode_one, codepoint_to_utf8, utf8_length, is_printable, is_whitespace, is_digit, trim, split), internalize helpers into anonymous namespace - platform_paths: Remove unused set_app_name/get_app_name, make s_app_name constexpr Deduplication: - chrome_renderer.cpp: Extract compute_grid_alpha() and append_grid_level() helpers, merge duplicate tick level builders into single generic lambda - range_cache.h: Merge validate_preview_range_cache_sequences into validate_range_cache_sequences with preview parameter - types.h: Add skip_gl and dark_mode to frame_context_t, eliminating 14 repeated config extractions across chrome_renderer, series_renderer, and text_renderer - platform_paths.cpp: Merge duplicate get_home_directory() for macOS/Linux https://claude.ai/code/session_01AHLB8zcNmNvtTXEa5aMGTP
The notify_opengl_status and notify_hlabels_subsecond lambdas dispatched to set_opengl_status_from_renderer(int) and set_hlabels_subsecond_from_renderer(bool) via string-based invokeMethod, but neither method exists on Plot_widget or any subclass in the codebase. The runtime indexOfMethod checks always returned false, making the dispatch calls unreachable dead code. Removes: two lambda definitions, five call sites, three bool flags (methods_checked, has_opengl_status_method, has_hlabels_subsecond_method), and three int fields (init_failed_status, last_opengl_status, last_hlabels_subsecond) from impl_t. Incorporated from branch claude/review-safe-dispatch-usage-omVTs. https://claude.ai/code/session_01AHLB8zcNmNvtTXEa5aMGTP
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
This PR removes unused functions, methods, and internal APIs to reduce code complexity and maintenance burden.
Summary
Significant cleanup of the codebase by removing unused or redundant functionality across multiple modules. This includes removing advanced dispatch methods from the Qt helper library, unused UTF-8 utilities, unnecessary data source methods, and internal metrics tracking.
Key Changes
Qt Safe Dispatch Library (
vnm_qt_safe_dispatch.h)safe_invoke()andsafe_emit()methods (synchronous/queued hybrid dispatch)blocking_invoke()andtry_blocking_invoke()(blocking cross-thread calls)post_emit()andpost_emit_batch()(signal emission helpers)post_invoke()for fire-and-forget method calls<QThread>,<exception>,<functional>,<optional>,<stdexcept>)UTF-8 Utilities (
utf8_utils.h/cpp)utf8_decode_one()from public API (kept as internal helper)codepoint_to_utf8()from public APIutf8_length(),is_printable(),is_whitespace(),is_digit(),trim(), andsplit()functionsutf8_to_codepoints()andcodepoints_to_utf8()for core conversionsData Source and Series APIs
timestamp()method fromfunction_sample_tgenerate_with_range()fromFunction_data_sourceset_preview_source()andset_preview_source_ref()fromseries_data_tensure_preview_config()private helperoperator!=()fromSize_2i(equality operator remains)Renderer and Core Components
snapshot_failurescounter) fromSeries_rendererPlot_rendererPlot_renderer::impl_toverride_directory()getter fromAsset_loaderset_app_name()function from platform pathsk_grid_line_half_pxAlgorithm and Layout
choose_lod_level()by removing unusedcurrent_levelparameterplatform_paths.cppImplementation Details
https://claude.ai/code/session_01AHLB8zcNmNvtTXEa5aMGTP